{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "# pandas 进阶修炼 ｜早起Python\n",
    "<br>\n",
    "\n",
    "**本习题由公众号【早起Python & 可视化图鉴】 原创，转载及其他形式合作请与我们联系（微信号`sshs321`)，未经授权严禁搬运及二次创作，侵权必究！**\n",
    "\n",
    "\n",
    "\n",
    "本习题基于 `pandas` 版本 `1.1.3`，所有内容应当在 `Jupyter Notebook` 中执行以获得最佳效果。\n",
    "\n",
    "不同版本之间写法可能会有少许不同，如若碰到此情况，你应该学会如何自行检索解决。"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 4 - 数据统计描述性分析\n",
    "\n",
    "\n",
    "<br>\n",
    "\n",
    "\n",
    "在上一章完成基本的数据预览以及缺失值和重复值的处理后。\n",
    "\n",
    "下一个步骤就是对数据进行简单的统计描述性分析，进一步观察数据特征。\n",
    "\n",
    "本章就整理了部分常见操作进行练习。"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 初始化\n",
    "\n",
    "<br>\n",
    "\n",
    "该 `Notebook` 版本为**纯习题版**\n",
    "\n",
    "如果需要答案或者提示，可以微信搜索公众号「早起Python」获取！"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 加载数据"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "source": [
    "import pandas as pd\n",
    "\n",
    "df = pd.read_excel(\"2020年中国大学排名.xlsx\")"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 数据探索"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 1 - 查看数据\n",
    "\n",
    "<br>\n",
    "\n",
    "查看数据前 10 行"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "source": [
    "df[:10]"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>学校名称</th>\n",
       "      <th>省市</th>\n",
       "      <th>学校类型</th>\n",
       "      <th>总分</th>\n",
       "      <th>办学层次得分</th>\n",
       "      <th>学科水平得分</th>\n",
       "      <th>办学资源得分</th>\n",
       "      <th>师资规模与结构得分</th>\n",
       "      <th>人才培养得分</th>\n",
       "      <th>科学研究得分</th>\n",
       "      <th>社会服务得分</th>\n",
       "      <th>高端人才得分</th>\n",
       "      <th>重大项目与成果得分</th>\n",
       "      <th>国际竞争力得分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>清华大学</td>\n",
       "      <td>北京</td>\n",
       "      <td>综合</td>\n",
       "      <td>852.5</td>\n",
       "      <td>38.2</td>\n",
       "      <td>72.4</td>\n",
       "      <td>39.6</td>\n",
       "      <td>48.4</td>\n",
       "      <td>256.8</td>\n",
       "      <td>69.1</td>\n",
       "      <td>40.6</td>\n",
       "      <td>76.5</td>\n",
       "      <td>131.0</td>\n",
       "      <td>79.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>北京大学</td>\n",
       "      <td>北京</td>\n",
       "      <td>综合</td>\n",
       "      <td>746.7</td>\n",
       "      <td>36.1</td>\n",
       "      <td>73.1</td>\n",
       "      <td>24.6</td>\n",
       "      <td>49.2</td>\n",
       "      <td>237.6</td>\n",
       "      <td>71.0</td>\n",
       "      <td>16.2</td>\n",
       "      <td>71.9</td>\n",
       "      <td>105.8</td>\n",
       "      <td>61.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>浙江大学</td>\n",
       "      <td>浙江</td>\n",
       "      <td>综合</td>\n",
       "      <td>649.2</td>\n",
       "      <td>33.9</td>\n",
       "      <td>65.3</td>\n",
       "      <td>20.1</td>\n",
       "      <td>48.3</td>\n",
       "      <td>215.3</td>\n",
       "      <td>68.6</td>\n",
       "      <td>23.9</td>\n",
       "      <td>49.1</td>\n",
       "      <td>81.7</td>\n",
       "      <td>43.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>上海交通大学</td>\n",
       "      <td>上海</td>\n",
       "      <td>综合</td>\n",
       "      <td>625.9</td>\n",
       "      <td>35.4</td>\n",
       "      <td>53.6</td>\n",
       "      <td>22.1</td>\n",
       "      <td>43.8</td>\n",
       "      <td>192.8</td>\n",
       "      <td>81.2</td>\n",
       "      <td>18.1</td>\n",
       "      <td>45.8</td>\n",
       "      <td>93.0</td>\n",
       "      <td>40.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>南京大学</td>\n",
       "      <td>江苏</td>\n",
       "      <td>综合</td>\n",
       "      <td>566.1</td>\n",
       "      <td>35.1</td>\n",
       "      <td>47.8</td>\n",
       "      <td>10.3</td>\n",
       "      <td>47.4</td>\n",
       "      <td>218.6</td>\n",
       "      <td>59.6</td>\n",
       "      <td>5.3</td>\n",
       "      <td>42.0</td>\n",
       "      <td>71.2</td>\n",
       "      <td>29.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>复旦大学</td>\n",
       "      <td>上海</td>\n",
       "      <td>综合</td>\n",
       "      <td>556.7</td>\n",
       "      <td>36.6</td>\n",
       "      <td>48.4</td>\n",
       "      <td>14.9</td>\n",
       "      <td>46.3</td>\n",
       "      <td>198.5</td>\n",
       "      <td>65.7</td>\n",
       "      <td>6.5</td>\n",
       "      <td>42.9</td>\n",
       "      <td>62.0</td>\n",
       "      <td>34.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>中国科学技术大学</td>\n",
       "      <td>安徽</td>\n",
       "      <td>理工</td>\n",
       "      <td>526.4</td>\n",
       "      <td>40.0</td>\n",
       "      <td>39.1</td>\n",
       "      <td>10.6</td>\n",
       "      <td>45.9</td>\n",
       "      <td>191.5</td>\n",
       "      <td>52.6</td>\n",
       "      <td>0.2</td>\n",
       "      <td>55.1</td>\n",
       "      <td>49.2</td>\n",
       "      <td>42.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>华中科技大学</td>\n",
       "      <td>湖北</td>\n",
       "      <td>综合</td>\n",
       "      <td>497.7</td>\n",
       "      <td>31.9</td>\n",
       "      <td>45.2</td>\n",
       "      <td>11.3</td>\n",
       "      <td>44.2</td>\n",
       "      <td>182.8</td>\n",
       "      <td>58.3</td>\n",
       "      <td>22.0</td>\n",
       "      <td>25.5</td>\n",
       "      <td>44.9</td>\n",
       "      <td>31.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>武汉大学</td>\n",
       "      <td>湖北</td>\n",
       "      <td>综合</td>\n",
       "      <td>488.0</td>\n",
       "      <td>31.7</td>\n",
       "      <td>48.4</td>\n",
       "      <td>9.9</td>\n",
       "      <td>45.3</td>\n",
       "      <td>198.8</td>\n",
       "      <td>51.3</td>\n",
       "      <td>11.8</td>\n",
       "      <td>21.4</td>\n",
       "      <td>44.2</td>\n",
       "      <td>25.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>中山大学</td>\n",
       "      <td>广东</td>\n",
       "      <td>综合</td>\n",
       "      <td>457.2</td>\n",
       "      <td>30.3</td>\n",
       "      <td>47.1</td>\n",
       "      <td>13.7</td>\n",
       "      <td>46.8</td>\n",
       "      <td>154.4</td>\n",
       "      <td>65.9</td>\n",
       "      <td>5.6</td>\n",
       "      <td>27.1</td>\n",
       "      <td>33.8</td>\n",
       "      <td>32.6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   排名      学校名称  省市 学校类型     总分  办学层次得分  学科水平得分  办学资源得分  师资规模与结构得分  人才培养得分  \\\n",
       "0   1      清华大学  北京   综合  852.5    38.2    72.4    39.6       48.4   256.8   \n",
       "1   2      北京大学  北京   综合  746.7    36.1    73.1    24.6       49.2   237.6   \n",
       "2   3      浙江大学  浙江   综合  649.2    33.9    65.3    20.1       48.3   215.3   \n",
       "3   4    上海交通大学  上海   综合  625.9    35.4    53.6    22.1       43.8   192.8   \n",
       "4   5      南京大学  江苏   综合  566.1    35.1    47.8    10.3       47.4   218.6   \n",
       "5   6      复旦大学  上海   综合  556.7    36.6    48.4    14.9       46.3   198.5   \n",
       "6   7  中国科学技术大学  安徽   理工  526.4    40.0    39.1    10.6       45.9   191.5   \n",
       "7   8    华中科技大学  湖北   综合  497.7    31.9    45.2    11.3       44.2   182.8   \n",
       "8   9      武汉大学  湖北   综合  488.0    31.7    48.4     9.9       45.3   198.8   \n",
       "9  10      中山大学  广东   综合  457.2    30.3    47.1    13.7       46.8   154.4   \n",
       "\n",
       "   科学研究得分  社会服务得分  高端人才得分  重大项目与成果得分  国际竞争力得分  \n",
       "0    69.1    40.6    76.5      131.0     79.9  \n",
       "1    71.0    16.2    71.9      105.8     61.2  \n",
       "2    68.6    23.9    49.1       81.7     43.0  \n",
       "3    81.2    18.1    45.8       93.0     40.1  \n",
       "4    59.6     5.3    42.0       71.2     29.0  \n",
       "5    65.7     6.5    42.9       62.0     34.8  \n",
       "6    52.6     0.2    55.1       49.2     42.2  \n",
       "7    58.3    22.0    25.5       44.9     31.8  \n",
       "8    51.3    11.8    21.4       44.2     25.2  \n",
       "9    65.9     5.6    27.1       33.8     32.6  "
      ]
     },
     "metadata": {},
     "execution_count": 3
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 2 - 修改索引\n",
    "\n",
    "<br>\n",
    "\n",
    "数据已经按照降序排列，让 学校 当索引会更好一点\n",
    "\n",
    "-> 修改索引为 学校名称 列"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "source": [
    "df.set_index('学校名称')"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>省市</th>\n",
       "      <th>学校类型</th>\n",
       "      <th>总分</th>\n",
       "      <th>办学层次得分</th>\n",
       "      <th>学科水平得分</th>\n",
       "      <th>办学资源得分</th>\n",
       "      <th>师资规模与结构得分</th>\n",
       "      <th>人才培养得分</th>\n",
       "      <th>科学研究得分</th>\n",
       "      <th>社会服务得分</th>\n",
       "      <th>高端人才得分</th>\n",
       "      <th>重大项目与成果得分</th>\n",
       "      <th>国际竞争力得分</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>学校名称</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>清华大学</th>\n",
       "      <td>1</td>\n",
       "      <td>北京</td>\n",
       "      <td>综合</td>\n",
       "      <td>852.5</td>\n",
       "      <td>38.2</td>\n",
       "      <td>72.4</td>\n",
       "      <td>39.6</td>\n",
       "      <td>48.4</td>\n",
       "      <td>256.8</td>\n",
       "      <td>69.1</td>\n",
       "      <td>40.6</td>\n",
       "      <td>76.5</td>\n",
       "      <td>131.0</td>\n",
       "      <td>79.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京大学</th>\n",
       "      <td>2</td>\n",
       "      <td>北京</td>\n",
       "      <td>综合</td>\n",
       "      <td>746.7</td>\n",
       "      <td>36.1</td>\n",
       "      <td>73.1</td>\n",
       "      <td>24.6</td>\n",
       "      <td>49.2</td>\n",
       "      <td>237.6</td>\n",
       "      <td>71.0</td>\n",
       "      <td>16.2</td>\n",
       "      <td>71.9</td>\n",
       "      <td>105.8</td>\n",
       "      <td>61.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>浙江大学</th>\n",
       "      <td>3</td>\n",
       "      <td>浙江</td>\n",
       "      <td>综合</td>\n",
       "      <td>649.2</td>\n",
       "      <td>33.9</td>\n",
       "      <td>65.3</td>\n",
       "      <td>20.1</td>\n",
       "      <td>48.3</td>\n",
       "      <td>215.3</td>\n",
       "      <td>68.6</td>\n",
       "      <td>23.9</td>\n",
       "      <td>49.1</td>\n",
       "      <td>81.7</td>\n",
       "      <td>43.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>上海交通大学</th>\n",
       "      <td>4</td>\n",
       "      <td>上海</td>\n",
       "      <td>综合</td>\n",
       "      <td>625.9</td>\n",
       "      <td>35.4</td>\n",
       "      <td>53.6</td>\n",
       "      <td>22.1</td>\n",
       "      <td>43.8</td>\n",
       "      <td>192.8</td>\n",
       "      <td>81.2</td>\n",
       "      <td>18.1</td>\n",
       "      <td>45.8</td>\n",
       "      <td>93.0</td>\n",
       "      <td>40.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>南京大学</th>\n",
       "      <td>5</td>\n",
       "      <td>江苏</td>\n",
       "      <td>综合</td>\n",
       "      <td>566.1</td>\n",
       "      <td>35.1</td>\n",
       "      <td>47.8</td>\n",
       "      <td>10.3</td>\n",
       "      <td>47.4</td>\n",
       "      <td>218.6</td>\n",
       "      <td>59.6</td>\n",
       "      <td>5.3</td>\n",
       "      <td>42.0</td>\n",
       "      <td>71.2</td>\n",
       "      <td>29.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>南京邮电大学</th>\n",
       "      <td>96</td>\n",
       "      <td>江苏</td>\n",
       "      <td>综合</td>\n",
       "      <td>213.9</td>\n",
       "      <td>25.0</td>\n",
       "      <td>12.5</td>\n",
       "      <td>2.4</td>\n",
       "      <td>34.8</td>\n",
       "      <td>101.2</td>\n",
       "      <td>12.4</td>\n",
       "      <td>6.5</td>\n",
       "      <td>1.6</td>\n",
       "      <td>4.6</td>\n",
       "      <td>13.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>河南大学</th>\n",
       "      <td>97</td>\n",
       "      <td>河南</td>\n",
       "      <td>综合</td>\n",
       "      <td>212.9</td>\n",
       "      <td>24.2</td>\n",
       "      <td>22.7</td>\n",
       "      <td>3.4</td>\n",
       "      <td>32.5</td>\n",
       "      <td>97.5</td>\n",
       "      <td>15.7</td>\n",
       "      <td>2.1</td>\n",
       "      <td>1.3</td>\n",
       "      <td>4.2</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>上海师范大学</th>\n",
       "      <td>98</td>\n",
       "      <td>上海</td>\n",
       "      <td>师范</td>\n",
       "      <td>212.8</td>\n",
       "      <td>27.3</td>\n",
       "      <td>17.9</td>\n",
       "      <td>3.6</td>\n",
       "      <td>32.1</td>\n",
       "      <td>96.9</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2.0</td>\n",
       "      <td>6.8</td>\n",
       "      <td>11.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>杭州电子科技大学</th>\n",
       "      <td>99</td>\n",
       "      <td>浙江</td>\n",
       "      <td>理工</td>\n",
       "      <td>211.6</td>\n",
       "      <td>25.4</td>\n",
       "      <td>12.6</td>\n",
       "      <td>2.7</td>\n",
       "      <td>36.5</td>\n",
       "      <td>103.4</td>\n",
       "      <td>12.0</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1.5</td>\n",
       "      <td>2.6</td>\n",
       "      <td>12.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广州大学</th>\n",
       "      <td>100</td>\n",
       "      <td>广东</td>\n",
       "      <td>综合</td>\n",
       "      <td>211.1</td>\n",
       "      <td>23.2</td>\n",
       "      <td>16.4</td>\n",
       "      <td>5.0</td>\n",
       "      <td>33.7</td>\n",
       "      <td>95.9</td>\n",
       "      <td>14.4</td>\n",
       "      <td>0.6</td>\n",
       "      <td>2.0</td>\n",
       "      <td>5.2</td>\n",
       "      <td>14.8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           排名  省市 学校类型     总分  办学层次得分  学科水平得分  办学资源得分  师资规模与结构得分  人才培养得分  \\\n",
       "学校名称                                                                       \n",
       "清华大学        1  北京   综合  852.5    38.2    72.4    39.6       48.4   256.8   \n",
       "北京大学        2  北京   综合  746.7    36.1    73.1    24.6       49.2   237.6   \n",
       "浙江大学        3  浙江   综合  649.2    33.9    65.3    20.1       48.3   215.3   \n",
       "上海交通大学      4  上海   综合  625.9    35.4    53.6    22.1       43.8   192.8   \n",
       "南京大学        5  江苏   综合  566.1    35.1    47.8    10.3       47.4   218.6   \n",
       "...       ...  ..  ...    ...     ...     ...     ...        ...     ...   \n",
       "南京邮电大学     96  江苏   综合  213.9    25.0    12.5     2.4       34.8   101.2   \n",
       "河南大学       97  河南   综合  212.9    24.2    22.7     3.4       32.5    97.5   \n",
       "上海师范大学     98  上海   师范  212.8    27.3    17.9     3.6       32.1    96.9   \n",
       "杭州电子科技大学   99  浙江   理工  211.6    25.4    12.6     2.7       36.5   103.4   \n",
       "广州大学      100  广东   综合  211.1    23.2    16.4     5.0       33.7    95.9   \n",
       "\n",
       "          科学研究得分  社会服务得分  高端人才得分  重大项目与成果得分  国际竞争力得分  \n",
       "学校名称                                                  \n",
       "清华大学        69.1    40.6    76.5      131.0     79.9  \n",
       "北京大学        71.0    16.2    71.9      105.8     61.2  \n",
       "浙江大学        68.6    23.9    49.1       81.7     43.0  \n",
       "上海交通大学      81.2    18.1    45.8       93.0     40.1  \n",
       "南京大学        59.6     5.3    42.0       71.2     29.0  \n",
       "...          ...     ...     ...        ...      ...  \n",
       "南京邮电大学      12.4     6.5     1.6        4.6     13.0  \n",
       "河南大学        15.7     2.1     1.3        4.2      9.2  \n",
       "上海师范大学      14.0     0.5     2.0        6.8     11.8  \n",
       "杭州电子科技大学    12.0     2.5     1.5        2.6     12.3  \n",
       "广州大学        14.4     0.6     2.0        5.2     14.8  \n",
       "\n",
       "[100 rows x 14 columns]"
      ]
     },
     "metadata": {},
     "execution_count": 4
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 3 - 查看数据量\n",
    "\n",
    "也就是数据框的 行 * 列，总共单元格的数量"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "source": [
    "df.shape"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "(100, 15)"
      ]
     },
     "metadata": {},
     "execution_count": 5
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 4 - 数据排序\n",
    "\n",
    "<br>\n",
    "\n",
    "将数据按照总分升序排列，并展示前20个学校\n",
    "\n",
    "备注：也就是看倒数20名啦"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "source": [
    "df.sort_values('总分', ascending=True)[:20]"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>学校名称</th>\n",
       "      <th>省市</th>\n",
       "      <th>学校类型</th>\n",
       "      <th>总分</th>\n",
       "      <th>办学层次得分</th>\n",
       "      <th>学科水平得分</th>\n",
       "      <th>办学资源得分</th>\n",
       "      <th>师资规模与结构得分</th>\n",
       "      <th>人才培养得分</th>\n",
       "      <th>科学研究得分</th>\n",
       "      <th>社会服务得分</th>\n",
       "      <th>高端人才得分</th>\n",
       "      <th>重大项目与成果得分</th>\n",
       "      <th>国际竞争力得分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>100</td>\n",
       "      <td>广州大学</td>\n",
       "      <td>广东</td>\n",
       "      <td>综合</td>\n",
       "      <td>211.1</td>\n",
       "      <td>23.2</td>\n",
       "      <td>16.4</td>\n",
       "      <td>5.0</td>\n",
       "      <td>33.7</td>\n",
       "      <td>95.9</td>\n",
       "      <td>14.4</td>\n",
       "      <td>0.6</td>\n",
       "      <td>2.0</td>\n",
       "      <td>5.2</td>\n",
       "      <td>14.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>99</td>\n",
       "      <td>杭州电子科技大学</td>\n",
       "      <td>浙江</td>\n",
       "      <td>理工</td>\n",
       "      <td>211.6</td>\n",
       "      <td>25.4</td>\n",
       "      <td>12.6</td>\n",
       "      <td>2.7</td>\n",
       "      <td>36.5</td>\n",
       "      <td>103.4</td>\n",
       "      <td>12.0</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1.5</td>\n",
       "      <td>2.6</td>\n",
       "      <td>12.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>98</td>\n",
       "      <td>上海师范大学</td>\n",
       "      <td>上海</td>\n",
       "      <td>师范</td>\n",
       "      <td>212.8</td>\n",
       "      <td>27.3</td>\n",
       "      <td>17.9</td>\n",
       "      <td>3.6</td>\n",
       "      <td>32.1</td>\n",
       "      <td>96.9</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2.0</td>\n",
       "      <td>6.8</td>\n",
       "      <td>11.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>97</td>\n",
       "      <td>河南大学</td>\n",
       "      <td>河南</td>\n",
       "      <td>综合</td>\n",
       "      <td>212.9</td>\n",
       "      <td>24.2</td>\n",
       "      <td>22.7</td>\n",
       "      <td>3.4</td>\n",
       "      <td>32.5</td>\n",
       "      <td>97.5</td>\n",
       "      <td>15.7</td>\n",
       "      <td>2.1</td>\n",
       "      <td>1.3</td>\n",
       "      <td>4.2</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>96</td>\n",
       "      <td>南京邮电大学</td>\n",
       "      <td>江苏</td>\n",
       "      <td>综合</td>\n",
       "      <td>213.9</td>\n",
       "      <td>25.0</td>\n",
       "      <td>12.5</td>\n",
       "      <td>2.4</td>\n",
       "      <td>34.8</td>\n",
       "      <td>101.2</td>\n",
       "      <td>12.4</td>\n",
       "      <td>6.5</td>\n",
       "      <td>1.6</td>\n",
       "      <td>4.6</td>\n",
       "      <td>13.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>95</td>\n",
       "      <td>广东工业大学</td>\n",
       "      <td>广东</td>\n",
       "      <td>理工</td>\n",
       "      <td>214.2</td>\n",
       "      <td>24.2</td>\n",
       "      <td>15.5</td>\n",
       "      <td>3.7</td>\n",
       "      <td>32.6</td>\n",
       "      <td>96.7</td>\n",
       "      <td>13.8</td>\n",
       "      <td>3.2</td>\n",
       "      <td>3.1</td>\n",
       "      <td>5.3</td>\n",
       "      <td>16.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>94</td>\n",
       "      <td>湖北大学</td>\n",
       "      <td>湖北</td>\n",
       "      <td>综合</td>\n",
       "      <td>214.5</td>\n",
       "      <td>26.3</td>\n",
       "      <td>14.7</td>\n",
       "      <td>2.3</td>\n",
       "      <td>35.0</td>\n",
       "      <td>105.8</td>\n",
       "      <td>10.5</td>\n",
       "      <td>2.9</td>\n",
       "      <td>1.2</td>\n",
       "      <td>3.7</td>\n",
       "      <td>12.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>93</td>\n",
       "      <td>南京信息工程大学</td>\n",
       "      <td>江苏</td>\n",
       "      <td>理工</td>\n",
       "      <td>216.6</td>\n",
       "      <td>23.6</td>\n",
       "      <td>16.1</td>\n",
       "      <td>2.4</td>\n",
       "      <td>33.6</td>\n",
       "      <td>97.5</td>\n",
       "      <td>15.1</td>\n",
       "      <td>4.7</td>\n",
       "      <td>2.1</td>\n",
       "      <td>3.6</td>\n",
       "      <td>18.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>92</td>\n",
       "      <td>燕山大学</td>\n",
       "      <td>河北</td>\n",
       "      <td>理工</td>\n",
       "      <td>216.7</td>\n",
       "      <td>26.6</td>\n",
       "      <td>15.2</td>\n",
       "      <td>2.3</td>\n",
       "      <td>34.5</td>\n",
       "      <td>107.2</td>\n",
       "      <td>12.6</td>\n",
       "      <td>2.8</td>\n",
       "      <td>2.5</td>\n",
       "      <td>4.8</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>91</td>\n",
       "      <td>长安大学</td>\n",
       "      <td>陕西</td>\n",
       "      <td>理工</td>\n",
       "      <td>218.9</td>\n",
       "      <td>27.2</td>\n",
       "      <td>14.0</td>\n",
       "      <td>3.7</td>\n",
       "      <td>34.1</td>\n",
       "      <td>104.9</td>\n",
       "      <td>12.1</td>\n",
       "      <td>12.4</td>\n",
       "      <td>1.1</td>\n",
       "      <td>1.1</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>90</td>\n",
       "      <td>安徽大学</td>\n",
       "      <td>安徽</td>\n",
       "      <td>综合</td>\n",
       "      <td>219.2</td>\n",
       "      <td>25.7</td>\n",
       "      <td>19.0</td>\n",
       "      <td>2.6</td>\n",
       "      <td>29.5</td>\n",
       "      <td>110.8</td>\n",
       "      <td>15.5</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.8</td>\n",
       "      <td>3.4</td>\n",
       "      <td>10.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>89</td>\n",
       "      <td>上海理工大学</td>\n",
       "      <td>上海</td>\n",
       "      <td>理工</td>\n",
       "      <td>221.4</td>\n",
       "      <td>28.3</td>\n",
       "      <td>16.4</td>\n",
       "      <td>3.6</td>\n",
       "      <td>32.3</td>\n",
       "      <td>105.7</td>\n",
       "      <td>12.6</td>\n",
       "      <td>9.8</td>\n",
       "      <td>1.3</td>\n",
       "      <td>1.5</td>\n",
       "      <td>9.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>88</td>\n",
       "      <td>华南农业大学</td>\n",
       "      <td>广东</td>\n",
       "      <td>农业</td>\n",
       "      <td>227.1</td>\n",
       "      <td>23.2</td>\n",
       "      <td>18.0</td>\n",
       "      <td>4.5</td>\n",
       "      <td>35.0</td>\n",
       "      <td>102.4</td>\n",
       "      <td>14.8</td>\n",
       "      <td>2.2</td>\n",
       "      <td>4.0</td>\n",
       "      <td>10.3</td>\n",
       "      <td>12.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86</th>\n",
       "      <td>87</td>\n",
       "      <td>南昌大学</td>\n",
       "      <td>江西</td>\n",
       "      <td>综合</td>\n",
       "      <td>228.4</td>\n",
       "      <td>27.3</td>\n",
       "      <td>21.1</td>\n",
       "      <td>4.1</td>\n",
       "      <td>32.3</td>\n",
       "      <td>105.2</td>\n",
       "      <td>15.6</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2.5</td>\n",
       "      <td>7.8</td>\n",
       "      <td>12.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>84</th>\n",
       "      <td>85</td>\n",
       "      <td>湖南师范大学</td>\n",
       "      <td>湖南</td>\n",
       "      <td>师范</td>\n",
       "      <td>233.4</td>\n",
       "      <td>27.9</td>\n",
       "      <td>20.6</td>\n",
       "      <td>2.7</td>\n",
       "      <td>35.2</td>\n",
       "      <td>109.8</td>\n",
       "      <td>15.7</td>\n",
       "      <td>0.5</td>\n",
       "      <td>1.9</td>\n",
       "      <td>7.7</td>\n",
       "      <td>11.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>85</td>\n",
       "      <td>首都师范大学</td>\n",
       "      <td>北京</td>\n",
       "      <td>师范</td>\n",
       "      <td>233.4</td>\n",
       "      <td>29.5</td>\n",
       "      <td>22.9</td>\n",
       "      <td>5.2</td>\n",
       "      <td>37.6</td>\n",
       "      <td>99.7</td>\n",
       "      <td>14.7</td>\n",
       "      <td>0.3</td>\n",
       "      <td>3.3</td>\n",
       "      <td>8.3</td>\n",
       "      <td>11.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>84</td>\n",
       "      <td>云南大学</td>\n",
       "      <td>云南</td>\n",
       "      <td>综合</td>\n",
       "      <td>234.1</td>\n",
       "      <td>29.0</td>\n",
       "      <td>22.8</td>\n",
       "      <td>5.0</td>\n",
       "      <td>30.8</td>\n",
       "      <td>111.6</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0.4</td>\n",
       "      <td>3.0</td>\n",
       "      <td>6.4</td>\n",
       "      <td>11.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>83</td>\n",
       "      <td>郑州大学</td>\n",
       "      <td>河南</td>\n",
       "      <td>综合</td>\n",
       "      <td>234.9</td>\n",
       "      <td>26.3</td>\n",
       "      <td>28.3</td>\n",
       "      <td>6.0</td>\n",
       "      <td>37.2</td>\n",
       "      <td>91.8</td>\n",
       "      <td>23.7</td>\n",
       "      <td>1.7</td>\n",
       "      <td>2.0</td>\n",
       "      <td>4.9</td>\n",
       "      <td>13.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>82</td>\n",
       "      <td>南京工业大学</td>\n",
       "      <td>江苏</td>\n",
       "      <td>理工</td>\n",
       "      <td>235.4</td>\n",
       "      <td>25.4</td>\n",
       "      <td>14.4</td>\n",
       "      <td>3.3</td>\n",
       "      <td>33.0</td>\n",
       "      <td>102.2</td>\n",
       "      <td>15.0</td>\n",
       "      <td>8.6</td>\n",
       "      <td>6.6</td>\n",
       "      <td>12.0</td>\n",
       "      <td>15.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80</th>\n",
       "      <td>81</td>\n",
       "      <td>浙江工业大学</td>\n",
       "      <td>浙江</td>\n",
       "      <td>理工</td>\n",
       "      <td>235.5</td>\n",
       "      <td>27.6</td>\n",
       "      <td>18.7</td>\n",
       "      <td>5.7</td>\n",
       "      <td>28.7</td>\n",
       "      <td>109.5</td>\n",
       "      <td>17.8</td>\n",
       "      <td>5.6</td>\n",
       "      <td>2.5</td>\n",
       "      <td>5.8</td>\n",
       "      <td>13.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     排名      学校名称  省市 学校类型     总分  办学层次得分  学科水平得分  办学资源得分  师资规模与结构得分  人才培养得分  \\\n",
       "99  100      广州大学  广东   综合  211.1    23.2    16.4     5.0       33.7    95.9   \n",
       "98   99  杭州电子科技大学  浙江   理工  211.6    25.4    12.6     2.7       36.5   103.4   \n",
       "97   98    上海师范大学  上海   师范  212.8    27.3    17.9     3.6       32.1    96.9   \n",
       "96   97      河南大学  河南   综合  212.9    24.2    22.7     3.4       32.5    97.5   \n",
       "95   96    南京邮电大学  江苏   综合  213.9    25.0    12.5     2.4       34.8   101.2   \n",
       "94   95    广东工业大学  广东   理工  214.2    24.2    15.5     3.7       32.6    96.7   \n",
       "93   94      湖北大学  湖北   综合  214.5    26.3    14.7     2.3       35.0   105.8   \n",
       "92   93  南京信息工程大学  江苏   理工  216.6    23.6    16.1     2.4       33.6    97.5   \n",
       "91   92      燕山大学  河北   理工  216.7    26.6    15.2     2.3       34.5   107.2   \n",
       "90   91      长安大学  陕西   理工  218.9    27.2    14.0     3.7       34.1   104.9   \n",
       "89   90      安徽大学  安徽   综合  219.2    25.7    19.0     2.6       29.5   110.8   \n",
       "88   89    上海理工大学  上海   理工  221.4    28.3    16.4     3.6       32.3   105.7   \n",
       "87   88    华南农业大学  广东   农业  227.1    23.2    18.0     4.5       35.0   102.4   \n",
       "86   87      南昌大学  江西   综合  228.4    27.3    21.1     4.1       32.3   105.2   \n",
       "84   85    湖南师范大学  湖南   师范  233.4    27.9    20.6     2.7       35.2   109.8   \n",
       "85   85    首都师范大学  北京   师范  233.4    29.5    22.9     5.2       37.6    99.7   \n",
       "83   84      云南大学  云南   综合  234.1    29.0    22.8     5.0       30.8   111.6   \n",
       "82   83      郑州大学  河南   综合  234.9    26.3    28.3     6.0       37.2    91.8   \n",
       "81   82    南京工业大学  江苏   理工  235.4    25.4    14.4     3.3       33.0   102.2   \n",
       "80   81    浙江工业大学  浙江   理工  235.5    27.6    18.7     5.7       28.7   109.5   \n",
       "\n",
       "    科学研究得分  社会服务得分  高端人才得分  重大项目与成果得分  国际竞争力得分  \n",
       "99    14.4     0.6     2.0        5.2     14.8  \n",
       "98    12.0     2.5     1.5        2.6     12.3  \n",
       "97    14.0     0.5     2.0        6.8     11.8  \n",
       "96    15.7     2.1     1.3        4.2      9.2  \n",
       "95    12.4     6.5     1.6        4.6     13.0  \n",
       "94    13.8     3.2     3.1        5.3     16.2  \n",
       "93    10.5     2.9     1.2        3.7     12.1  \n",
       "92    15.1     4.7     2.1        3.6     18.0  \n",
       "91    12.6     2.8     2.5        4.8      8.2  \n",
       "90    12.1    12.4     1.1        1.1      8.2  \n",
       "89    15.5     1.4     0.8        3.4     10.5  \n",
       "88    12.6     9.8     1.3        1.5      9.9  \n",
       "87    14.8     2.2     4.0       10.3     12.7  \n",
       "86    15.6     0.5     2.5        7.8     12.0  \n",
       "84    15.7     0.5     1.9        7.7     11.4  \n",
       "85    14.7     0.3     3.3        8.3     11.8  \n",
       "83    14.0     0.4     3.0        6.4     11.2  \n",
       "82    23.7     1.7     2.0        4.9     13.0  \n",
       "81    15.0     8.6     6.6       12.0     15.1  \n",
       "80    17.8     5.6     2.5        5.8     13.5  "
      ]
     },
     "metadata": {},
     "execution_count": 6
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 5 - 数据排序\n",
    "\n",
    "将数据按照 高端人才得分 降序排序，展示前 10 位"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "source": [
    "df.sort_values('高端人才得分', ascending=False)[:10]"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>学校名称</th>\n",
       "      <th>省市</th>\n",
       "      <th>学校类型</th>\n",
       "      <th>总分</th>\n",
       "      <th>办学层次得分</th>\n",
       "      <th>学科水平得分</th>\n",
       "      <th>办学资源得分</th>\n",
       "      <th>师资规模与结构得分</th>\n",
       "      <th>人才培养得分</th>\n",
       "      <th>科学研究得分</th>\n",
       "      <th>社会服务得分</th>\n",
       "      <th>高端人才得分</th>\n",
       "      <th>重大项目与成果得分</th>\n",
       "      <th>国际竞争力得分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>清华大学</td>\n",
       "      <td>北京</td>\n",
       "      <td>综合</td>\n",
       "      <td>852.5</td>\n",
       "      <td>38.2</td>\n",
       "      <td>72.4</td>\n",
       "      <td>39.6</td>\n",
       "      <td>48.4</td>\n",
       "      <td>256.8</td>\n",
       "      <td>69.1</td>\n",
       "      <td>40.6</td>\n",
       "      <td>76.5</td>\n",
       "      <td>131.0</td>\n",
       "      <td>79.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>北京大学</td>\n",
       "      <td>北京</td>\n",
       "      <td>综合</td>\n",
       "      <td>746.7</td>\n",
       "      <td>36.1</td>\n",
       "      <td>73.1</td>\n",
       "      <td>24.6</td>\n",
       "      <td>49.2</td>\n",
       "      <td>237.6</td>\n",
       "      <td>71.0</td>\n",
       "      <td>16.2</td>\n",
       "      <td>71.9</td>\n",
       "      <td>105.8</td>\n",
       "      <td>61.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>中国科学技术大学</td>\n",
       "      <td>安徽</td>\n",
       "      <td>理工</td>\n",
       "      <td>526.4</td>\n",
       "      <td>40.0</td>\n",
       "      <td>39.1</td>\n",
       "      <td>10.6</td>\n",
       "      <td>45.9</td>\n",
       "      <td>191.5</td>\n",
       "      <td>52.6</td>\n",
       "      <td>0.2</td>\n",
       "      <td>55.1</td>\n",
       "      <td>49.2</td>\n",
       "      <td>42.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>浙江大学</td>\n",
       "      <td>浙江</td>\n",
       "      <td>综合</td>\n",
       "      <td>649.2</td>\n",
       "      <td>33.9</td>\n",
       "      <td>65.3</td>\n",
       "      <td>20.1</td>\n",
       "      <td>48.3</td>\n",
       "      <td>215.3</td>\n",
       "      <td>68.6</td>\n",
       "      <td>23.9</td>\n",
       "      <td>49.1</td>\n",
       "      <td>81.7</td>\n",
       "      <td>43.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>上海交通大学</td>\n",
       "      <td>上海</td>\n",
       "      <td>综合</td>\n",
       "      <td>625.9</td>\n",
       "      <td>35.4</td>\n",
       "      <td>53.6</td>\n",
       "      <td>22.1</td>\n",
       "      <td>43.8</td>\n",
       "      <td>192.8</td>\n",
       "      <td>81.2</td>\n",
       "      <td>18.1</td>\n",
       "      <td>45.8</td>\n",
       "      <td>93.0</td>\n",
       "      <td>40.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>复旦大学</td>\n",
       "      <td>上海</td>\n",
       "      <td>综合</td>\n",
       "      <td>556.7</td>\n",
       "      <td>36.6</td>\n",
       "      <td>48.4</td>\n",
       "      <td>14.9</td>\n",
       "      <td>46.3</td>\n",
       "      <td>198.5</td>\n",
       "      <td>65.7</td>\n",
       "      <td>6.5</td>\n",
       "      <td>42.9</td>\n",
       "      <td>62.0</td>\n",
       "      <td>34.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>南京大学</td>\n",
       "      <td>江苏</td>\n",
       "      <td>综合</td>\n",
       "      <td>566.1</td>\n",
       "      <td>35.1</td>\n",
       "      <td>47.8</td>\n",
       "      <td>10.3</td>\n",
       "      <td>47.4</td>\n",
       "      <td>218.6</td>\n",
       "      <td>59.6</td>\n",
       "      <td>5.3</td>\n",
       "      <td>42.0</td>\n",
       "      <td>71.2</td>\n",
       "      <td>29.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>46</td>\n",
       "      <td>南方科技大学</td>\n",
       "      <td>广东</td>\n",
       "      <td>综合</td>\n",
       "      <td>289.0</td>\n",
       "      <td>26.7</td>\n",
       "      <td>7.1</td>\n",
       "      <td>16.9</td>\n",
       "      <td>41.9</td>\n",
       "      <td>105.0</td>\n",
       "      <td>26.4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>38.9</td>\n",
       "      <td>7.1</td>\n",
       "      <td>18.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>中山大学</td>\n",
       "      <td>广东</td>\n",
       "      <td>综合</td>\n",
       "      <td>457.2</td>\n",
       "      <td>30.3</td>\n",
       "      <td>47.1</td>\n",
       "      <td>13.7</td>\n",
       "      <td>46.8</td>\n",
       "      <td>154.4</td>\n",
       "      <td>65.9</td>\n",
       "      <td>5.6</td>\n",
       "      <td>27.1</td>\n",
       "      <td>33.8</td>\n",
       "      <td>32.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>华中科技大学</td>\n",
       "      <td>湖北</td>\n",
       "      <td>综合</td>\n",
       "      <td>497.7</td>\n",
       "      <td>31.9</td>\n",
       "      <td>45.2</td>\n",
       "      <td>11.3</td>\n",
       "      <td>44.2</td>\n",
       "      <td>182.8</td>\n",
       "      <td>58.3</td>\n",
       "      <td>22.0</td>\n",
       "      <td>25.5</td>\n",
       "      <td>44.9</td>\n",
       "      <td>31.8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    排名      学校名称  省市 学校类型     总分  办学层次得分  学科水平得分  办学资源得分  师资规模与结构得分  人才培养得分  \\\n",
       "0    1      清华大学  北京   综合  852.5    38.2    72.4    39.6       48.4   256.8   \n",
       "1    2      北京大学  北京   综合  746.7    36.1    73.1    24.6       49.2   237.6   \n",
       "6    7  中国科学技术大学  安徽   理工  526.4    40.0    39.1    10.6       45.9   191.5   \n",
       "2    3      浙江大学  浙江   综合  649.2    33.9    65.3    20.1       48.3   215.3   \n",
       "3    4    上海交通大学  上海   综合  625.9    35.4    53.6    22.1       43.8   192.8   \n",
       "5    6      复旦大学  上海   综合  556.7    36.6    48.4    14.9       46.3   198.5   \n",
       "4    5      南京大学  江苏   综合  566.1    35.1    47.8    10.3       47.4   218.6   \n",
       "45  46    南方科技大学  广东   综合  289.0    26.7     7.1    16.9       41.9   105.0   \n",
       "9   10      中山大学  广东   综合  457.2    30.3    47.1    13.7       46.8   154.4   \n",
       "7    8    华中科技大学  湖北   综合  497.7    31.9    45.2    11.3       44.2   182.8   \n",
       "\n",
       "    科学研究得分  社会服务得分  高端人才得分  重大项目与成果得分  国际竞争力得分  \n",
       "0     69.1    40.6    76.5      131.0     79.9  \n",
       "1     71.0    16.2    71.9      105.8     61.2  \n",
       "6     52.6     0.2    55.1       49.2     42.2  \n",
       "2     68.6    23.9    49.1       81.7     43.0  \n",
       "3     81.2    18.1    45.8       93.0     40.1  \n",
       "5     65.7     6.5    42.9       62.0     34.8  \n",
       "4     59.6     5.3    42.0       71.2     29.0  \n",
       "45    26.4     1.0    38.9        7.1     18.0  \n",
       "9     65.9     5.6    27.1       33.8     32.6  \n",
       "7     58.3    22.0    25.5       44.9     31.8  "
      ]
     },
     "metadata": {},
     "execution_count": 7
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 6 - 分列排名\n",
    "\n",
    "<br>\n",
    "\n",
    "查看各项得分最高的学校名称"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "source": [
    "colmax = df.max(axis=0)\n",
    "\n",
    "#(df.办学层次得分 == colmax.办学层次得分) | (df.总分 == colmax.总分)\n",
    "\n",
    "#df1 = df[(df.总分 == colmax.总分) | (df.办学层次得分 == colmax.办学层次得分)  | (df.学科水平得分\t == colmax.学科水平得分\t) | (df.办学资源得分 == colmax.办学资源得分) | (df.师资规模与结构得分 == colmax.师资规模与结构得分) | (df.人才培养得分 == colmax.人才培养得分) | (df.科学研究得分 == colmax.科学研究得分)\n",
    "#    | (df.社会服务得分 == colmax.社会服务得分) | (df.高端人才得分 == colmax.高端人才得分)  | (df.重大项目与成果得分 == colmax.重大项目与成果得分)  | (df.\t国际竞争力得分 == colmax.\t国际竞争力得分)]\n",
    "\n",
    "mask = pd.Series(data = [False for i in range(0, len(df))])\n",
    "for i in range(4 ,len(colmax)):\n",
    "    k = colmax.index[i]\n",
    "    v = colmax.iloc[i]\n",
    "\n",
    "    mask |= (df[k] == v)\n",
    "\n",
    "df1 = df[mask]\n",
    "\n",
    "df1.style.highlight_max(color='#888800', subset=df1.columns.tolist()[4:])\n",
    "\n"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_66a95_row0_col4, #T_66a95_row0_col7, #T_66a95_row0_col9, #T_66a95_row0_col11, #T_66a95_row0_col12, #T_66a95_row0_col13, #T_66a95_row0_col14, #T_66a95_row1_col6, #T_66a95_row1_col8, #T_66a95_row2_col10, #T_66a95_row3_col5 {\n",
       "  background-color: #888800;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_66a95_\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th class=\"col_heading level0 col0\" >排名</th>\n",
       "      <th class=\"col_heading level0 col1\" >学校名称</th>\n",
       "      <th class=\"col_heading level0 col2\" >省市</th>\n",
       "      <th class=\"col_heading level0 col3\" >学校类型</th>\n",
       "      <th class=\"col_heading level0 col4\" >总分</th>\n",
       "      <th class=\"col_heading level0 col5\" >办学层次得分</th>\n",
       "      <th class=\"col_heading level0 col6\" >学科水平得分</th>\n",
       "      <th class=\"col_heading level0 col7\" >办学资源得分</th>\n",
       "      <th class=\"col_heading level0 col8\" >师资规模与结构得分</th>\n",
       "      <th class=\"col_heading level0 col9\" >人才培养得分</th>\n",
       "      <th class=\"col_heading level0 col10\" >科学研究得分</th>\n",
       "      <th class=\"col_heading level0 col11\" >社会服务得分</th>\n",
       "      <th class=\"col_heading level0 col12\" >高端人才得分</th>\n",
       "      <th class=\"col_heading level0 col13\" >重大项目与成果得分</th>\n",
       "      <th class=\"col_heading level0 col14\" >国际竞争力得分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_66a95_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_66a95_row0_col0\" class=\"data row0 col0\" >1</td>\n",
       "      <td id=\"T_66a95_row0_col1\" class=\"data row0 col1\" >清华大学</td>\n",
       "      <td id=\"T_66a95_row0_col2\" class=\"data row0 col2\" >北京</td>\n",
       "      <td id=\"T_66a95_row0_col3\" class=\"data row0 col3\" >综合</td>\n",
       "      <td id=\"T_66a95_row0_col4\" class=\"data row0 col4\" >852.500000</td>\n",
       "      <td id=\"T_66a95_row0_col5\" class=\"data row0 col5\" >38.200000</td>\n",
       "      <td id=\"T_66a95_row0_col6\" class=\"data row0 col6\" >72.400000</td>\n",
       "      <td id=\"T_66a95_row0_col7\" class=\"data row0 col7\" >39.600000</td>\n",
       "      <td id=\"T_66a95_row0_col8\" class=\"data row0 col8\" >48.400000</td>\n",
       "      <td id=\"T_66a95_row0_col9\" class=\"data row0 col9\" >256.800000</td>\n",
       "      <td id=\"T_66a95_row0_col10\" class=\"data row0 col10\" >69.100000</td>\n",
       "      <td id=\"T_66a95_row0_col11\" class=\"data row0 col11\" >40.600000</td>\n",
       "      <td id=\"T_66a95_row0_col12\" class=\"data row0 col12\" >76.500000</td>\n",
       "      <td id=\"T_66a95_row0_col13\" class=\"data row0 col13\" >131.000000</td>\n",
       "      <td id=\"T_66a95_row0_col14\" class=\"data row0 col14\" >79.900000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_66a95_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_66a95_row1_col0\" class=\"data row1 col0\" >2</td>\n",
       "      <td id=\"T_66a95_row1_col1\" class=\"data row1 col1\" >北京大学</td>\n",
       "      <td id=\"T_66a95_row1_col2\" class=\"data row1 col2\" >北京</td>\n",
       "      <td id=\"T_66a95_row1_col3\" class=\"data row1 col3\" >综合</td>\n",
       "      <td id=\"T_66a95_row1_col4\" class=\"data row1 col4\" >746.700000</td>\n",
       "      <td id=\"T_66a95_row1_col5\" class=\"data row1 col5\" >36.100000</td>\n",
       "      <td id=\"T_66a95_row1_col6\" class=\"data row1 col6\" >73.100000</td>\n",
       "      <td id=\"T_66a95_row1_col7\" class=\"data row1 col7\" >24.600000</td>\n",
       "      <td id=\"T_66a95_row1_col8\" class=\"data row1 col8\" >49.200000</td>\n",
       "      <td id=\"T_66a95_row1_col9\" class=\"data row1 col9\" >237.600000</td>\n",
       "      <td id=\"T_66a95_row1_col10\" class=\"data row1 col10\" >71.000000</td>\n",
       "      <td id=\"T_66a95_row1_col11\" class=\"data row1 col11\" >16.200000</td>\n",
       "      <td id=\"T_66a95_row1_col12\" class=\"data row1 col12\" >71.900000</td>\n",
       "      <td id=\"T_66a95_row1_col13\" class=\"data row1 col13\" >105.800000</td>\n",
       "      <td id=\"T_66a95_row1_col14\" class=\"data row1 col14\" >61.200000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_66a95_level0_row2\" class=\"row_heading level0 row2\" >3</th>\n",
       "      <td id=\"T_66a95_row2_col0\" class=\"data row2 col0\" >4</td>\n",
       "      <td id=\"T_66a95_row2_col1\" class=\"data row2 col1\" >上海交通大学</td>\n",
       "      <td id=\"T_66a95_row2_col2\" class=\"data row2 col2\" >上海</td>\n",
       "      <td id=\"T_66a95_row2_col3\" class=\"data row2 col3\" >综合</td>\n",
       "      <td id=\"T_66a95_row2_col4\" class=\"data row2 col4\" >625.900000</td>\n",
       "      <td id=\"T_66a95_row2_col5\" class=\"data row2 col5\" >35.400000</td>\n",
       "      <td id=\"T_66a95_row2_col6\" class=\"data row2 col6\" >53.600000</td>\n",
       "      <td id=\"T_66a95_row2_col7\" class=\"data row2 col7\" >22.100000</td>\n",
       "      <td id=\"T_66a95_row2_col8\" class=\"data row2 col8\" >43.800000</td>\n",
       "      <td id=\"T_66a95_row2_col9\" class=\"data row2 col9\" >192.800000</td>\n",
       "      <td id=\"T_66a95_row2_col10\" class=\"data row2 col10\" >81.200000</td>\n",
       "      <td id=\"T_66a95_row2_col11\" class=\"data row2 col11\" >18.100000</td>\n",
       "      <td id=\"T_66a95_row2_col12\" class=\"data row2 col12\" >45.800000</td>\n",
       "      <td id=\"T_66a95_row2_col13\" class=\"data row2 col13\" >93.000000</td>\n",
       "      <td id=\"T_66a95_row2_col14\" class=\"data row2 col14\" >40.100000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_66a95_level0_row3\" class=\"row_heading level0 row3\" >6</th>\n",
       "      <td id=\"T_66a95_row3_col0\" class=\"data row3 col0\" >7</td>\n",
       "      <td id=\"T_66a95_row3_col1\" class=\"data row3 col1\" >中国科学技术大学</td>\n",
       "      <td id=\"T_66a95_row3_col2\" class=\"data row3 col2\" >安徽</td>\n",
       "      <td id=\"T_66a95_row3_col3\" class=\"data row3 col3\" >理工</td>\n",
       "      <td id=\"T_66a95_row3_col4\" class=\"data row3 col4\" >526.400000</td>\n",
       "      <td id=\"T_66a95_row3_col5\" class=\"data row3 col5\" >40.000000</td>\n",
       "      <td id=\"T_66a95_row3_col6\" class=\"data row3 col6\" >39.100000</td>\n",
       "      <td id=\"T_66a95_row3_col7\" class=\"data row3 col7\" >10.600000</td>\n",
       "      <td id=\"T_66a95_row3_col8\" class=\"data row3 col8\" >45.900000</td>\n",
       "      <td id=\"T_66a95_row3_col9\" class=\"data row3 col9\" >191.500000</td>\n",
       "      <td id=\"T_66a95_row3_col10\" class=\"data row3 col10\" >52.600000</td>\n",
       "      <td id=\"T_66a95_row3_col11\" class=\"data row3 col11\" >0.200000</td>\n",
       "      <td id=\"T_66a95_row3_col12\" class=\"data row3 col12\" >55.100000</td>\n",
       "      <td id=\"T_66a95_row3_col13\" class=\"data row3 col13\" >49.200000</td>\n",
       "      <td id=\"T_66a95_row3_col14\" class=\"data row3 col14\" >42.200000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7fc6764f3748>"
      ]
     },
     "metadata": {},
     "execution_count": 8
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 7 - 统计信息｜均值\n",
    "\n",
    "计算总分列的均值"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "source": [
    "df['总分'].mean()"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "322.5"
      ]
     },
     "metadata": {},
     "execution_count": 9
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 8 - 统计信息｜中位数\n",
    "\n",
    "<br>\n",
    "\n",
    "计算总分列的中位数"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "source": [
    "df.总分.median()"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "279.65"
      ]
     },
     "metadata": {},
     "execution_count": 10
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 9 - 统计信息｜众数\n",
    "\n",
    "\n",
    "计算总分列的众数"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 10 -统计信息｜部分\r\n",
    "\r\n",
    "计算 总分、高端人才得分、办学层次得分的最大最小值、中位数、均值"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "source": [
    "#df1 = pd.DataFrame(data={'key': ['总分','高端人才得分','办学层次得分'], \n",
    "#                         'max': [df.总分.max(), df.高端人才得分.max(), df['办学层次得分'].max()],\n",
    "#                         'min': [df['总分'].min(), df['高端人才得分'].min(), df['办学层次得分'].min()], \n",
    "#                         'median': [df['总分'].median(), df['高端人才得分'].median(), df['办学层次得分'].median()],\n",
    "#                         'mean': [df['总分'].mean(), df['高端人才得分'].mean(), df['办学层次得分'].mean()]\n",
    "#})\n",
    "#df1\n",
    "\n",
    "df[['总分','高端人才得分','办学层次得分']].agg(['max','min','mean'])"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>总分</th>\n",
       "      <th>高端人才得分</th>\n",
       "      <th>办学层次得分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>852.5</td>\n",
       "      <td>76.500</td>\n",
       "      <td>40.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>211.1</td>\n",
       "      <td>0.800</td>\n",
       "      <td>23.200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>322.5</td>\n",
       "      <td>11.176</td>\n",
       "      <td>29.692</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         总分  高端人才得分  办学层次得分\n",
       "max   852.5  76.500  40.000\n",
       "min   211.1   0.800  23.200\n",
       "mean  322.5  11.176  29.692"
      ]
     },
     "metadata": {},
     "execution_count": 13
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 11 - 统计信息｜完整\r\n",
    "\r\n",
    "<br>\r\n",
    "\r\n",
    "查看数值型数据的统计信息（均值、分位数等），并保留两位小数"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 12 - 统计信息｜分组\n",
    "\n",
    "计算各省市总分均值"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "source": [
    "df.groupby(by='省市')['总分'].mean()\n",
    "#dfg.size()"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "省市\n",
       "上海     350.510000\n",
       "云南     234.100000\n",
       "北京     362.827778\n",
       "吉林     326.000000\n",
       "四川     349.266667\n",
       "天津     396.200000\n",
       "安徽     328.700000\n",
       "山东     304.633333\n",
       "广东     286.011111\n",
       "江苏     298.386667\n",
       "江西     228.400000\n",
       "河北     216.700000\n",
       "河南     223.900000\n",
       "浙江     335.150000\n",
       "湖北     335.085714\n",
       "湖南     320.100000\n",
       "甘肃     300.400000\n",
       "福建     313.550000\n",
       "辽宁     339.550000\n",
       "重庆     289.200000\n",
       "陕西     297.685714\n",
       "黑龙江    364.800000\n",
       "Name: 总分, dtype: float64"
      ]
     },
     "metadata": {},
     "execution_count": 19
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 13 - 统计信息｜相关系数\n",
    "\n",
    "<br>\n",
    "\n",
    "也就是相关系数矩阵，也就是每两列之间的相关性系数"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "source": [],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "0         清华大学\n",
       "1         北京大学\n",
       "2         浙江大学\n",
       "3       上海交通大学\n",
       "4         南京大学\n",
       "        ...   \n",
       "95      南京邮电大学\n",
       "96        河南大学\n",
       "97      上海师范大学\n",
       "98    杭州电子科技大学\n",
       "99        广州大学\n",
       "Name: 学校名称, Length: 100, dtype: object"
      ]
     },
     "metadata": {},
     "execution_count": 126
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 14 - 相关系数｜热力图\n",
    "\n",
    "<br>\n",
    "\n",
    "将上一题的相关性系数矩阵制作为热力图"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "source": [],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "0         清华大学\n",
       "1         北京大学\n",
       "2         浙江大学\n",
       "3       上海交通大学\n",
       "4         南京大学\n",
       "        ...   \n",
       "95      南京邮电大学\n",
       "96        河南大学\n",
       "97      上海师范大学\n",
       "98    杭州电子科技大学\n",
       "99        广州大学\n",
       "Name: 学校名称, Length: 100, dtype: object"
      ]
     },
     "metadata": {},
     "execution_count": 127
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 15 - 统计信息｜频率\n",
    "\n",
    "计算各省市出现的次数"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "source": [
    "### 错误 ！！！\n",
    "\n",
    "dfg = df.groupby(by='省市')\n",
    "data = []\n",
    "for i in dfg.size().index:\n",
    "    data.append([ i, len(df[df.学校名称.str.contains(i)]) ])\n",
    "\n",
    "df1 = pd.DataFrame(data, columns=['key','count'])\n",
    "df1\n",
    "\n"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>key</th>\n",
       "      <th>count</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>上海</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>云南</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>北京</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>吉林</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>四川</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>天津</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>安徽</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>山东</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>广东</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>江苏</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>江西</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>河北</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>河南</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>浙江</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>湖北</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>湖南</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>甘肃</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>福建</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>辽宁</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>重庆</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>陕西</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>黑龙江</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    key  count\n",
       "0    上海      6\n",
       "1    云南      2\n",
       "2    北京     14\n",
       "3    吉林      2\n",
       "4    四川      2\n",
       "5    天津      2\n",
       "6    安徽      2\n",
       "7    山东      2\n",
       "8    广东      2\n",
       "9    江苏      2\n",
       "10   江西      1\n",
       "11   河北      1\n",
       "12   河南      2\n",
       "13   浙江      3\n",
       "14   湖北      2\n",
       "15   湖南      3\n",
       "16   甘肃      1\n",
       "17   福建      1\n",
       "18   辽宁      1\n",
       "19   重庆      2\n",
       "20   陕西      2\n",
       "21  黑龙江      1"
      ]
     },
     "metadata": {},
     "execution_count": 142
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "source": [
    "import numpy as np\n",
    "df.pivot_table(index='省市', values='学校名称',aggfunc=lambda x: x.str.contains(df.loc[x.index[0]]['省市']).sum()) "
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>学校名称</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>省市</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>上海</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云南</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>吉林</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>四川</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>天津</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>安徽</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>山东</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广东</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江苏</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江西</th>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>河北</th>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>河南</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>浙江</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>湖北</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>湖南</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>甘肃</th>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>福建</th>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>辽宁</th>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>重庆</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>陕西</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>黑龙江</th>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     学校名称\n",
       "省市       \n",
       "上海      5\n",
       "云南      1\n",
       "北京     13\n",
       "吉林      1\n",
       "四川      1\n",
       "天津      1\n",
       "安徽      1\n",
       "山东      1\n",
       "广东      1\n",
       "江苏      1\n",
       "江西      0\n",
       "河北      0\n",
       "河南      1\n",
       "浙江      2\n",
       "湖北      1\n",
       "湖南      2\n",
       "甘肃      0\n",
       "福建      0\n",
       "辽宁      0\n",
       "重庆      1\n",
       "陕西      1\n",
       "黑龙江     0"
      ]
     },
     "metadata": {},
     "execution_count": 41
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "source": [
    "df.groupby('省市')['学校名称'].apply(lambda x: x.str.contains(df.loc[x.index[0]]['省市']).sum())"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "省市\n",
       "上海      5\n",
       "云南      1\n",
       "北京     13\n",
       "吉林      1\n",
       "四川      1\n",
       "天津      1\n",
       "安徽      1\n",
       "山东      1\n",
       "广东      1\n",
       "江苏      1\n",
       "江西      0\n",
       "河北      0\n",
       "河南      1\n",
       "浙江      2\n",
       "湖北      1\n",
       "湖南      2\n",
       "甘肃      0\n",
       "福建      0\n",
       "辽宁      0\n",
       "重庆      1\n",
       "陕西      1\n",
       "黑龙江     0\n",
       "Name: 学校名称, dtype: int64"
      ]
     },
     "metadata": {},
     "execution_count": 42
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 16 - 统计信息｜热力地图\n",
    "\n",
    "结合 `pyecharts` 将各省市高校上榜数量进行地图可视化"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 17 - 统计信息｜直方图\n",
    "\n",
    "绘制总分的直方图、密度估计图"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 2 个 pandas EDA 插件"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "在 pandas 之外，还有两个插件可以快速实现 EDA\n",
    "\n",
    "下面不作为习题，仅供介绍，感兴趣可以进一步搜索了解\n",
    "\n",
    "执行全部代码即可获得 EDA 报告！"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 18 - pandas_profiling\n",
    "\n",
    "<br>\n",
    "\n",
    "如果没有提前安装 `pandas_profiling` 的话，需要提前 `pip` 进行安装"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "source": [
    "! pip install pandas_profiling"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Collecting pandas_profiling\n",
      "  Downloading pandas_profiling-3.1.0-py2.py3-none-any.whl (261 kB)\n",
      "Collecting htmlmin>=0.1.12\n",
      "  Downloading htmlmin-0.1.12.tar.gz (19 kB)\n",
      "Requirement already satisfied: scipy>=1.4.1 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (1.7.1)\n",
      "Requirement already satisfied: jinja2>=2.11.1 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (3.0.1)\n",
      "Requirement already satisfied: matplotlib>=3.2.0 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (3.4.2)\n",
      "Collecting visions[type_image_path]==0.7.4\n",
      "  Downloading visions-0.7.4-py3-none-any.whl (102 kB)\n",
      "Collecting multimethod>=1.4\n",
      "  Downloading multimethod-1.6-py3-none-any.whl (9.4 kB)\n",
      "Requirement already satisfied: markupsafe~=2.0.1 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (2.0.1)\n",
      "Requirement already satisfied: numpy>=1.16.0 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (1.21.0)\n",
      "Collecting PyYAML>=5.0.0\n",
      "  Downloading PyYAML-5.4.1-cp39-cp39-win_amd64.whl (213 kB)\n",
      "Requirement already satisfied: tqdm>=4.48.2 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (4.61.2)\n",
      "Requirement already satisfied: pandas!=1.0.0,!=1.0.1,!=1.0.2,!=1.1.0,>=0.25.3 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (1.3.0)\n",
      "Collecting pydantic>=1.8.1\n",
      "  Downloading pydantic-1.8.2-cp39-cp39-win_amd64.whl (1.9 MB)\n",
      "Collecting missingno>=0.4.2\n",
      "  Downloading missingno-0.5.0-py3-none-any.whl (8.8 kB)\n",
      "Requirement already satisfied: requests>=2.24.0 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (2.25.1)\n",
      "Collecting tangled-up-in-unicode==0.1.0\n",
      "  Downloading tangled_up_in_unicode-0.1.0-py3-none-any.whl (3.1 MB)\n",
      "Requirement already satisfied: seaborn>=0.10.1 in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from pandas_profiling) (0.11.2)\n",
      "Collecting joblib~=1.0.1\n",
      "  Downloading joblib-1.0.1-py3-none-any.whl (303 kB)\n",
      "Collecting phik>=0.11.1\n",
      "  Downloading phik-0.12.0-cp39-cp39-win_amd64.whl (659 kB)\n",
      "Collecting networkx>=2.4\n",
      "  Downloading networkx-2.6.3-py3-none-any.whl (1.9 MB)\n",
      "Collecting attrs>=19.3.0\n",
      "  Downloading attrs-21.2.0-py2.py3-none-any.whl (53 kB)\n",
      "Requirement already satisfied: Pillow in c:\\users\\songzhao\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from visions[type_image_path]==0.7.4->pandas_profiling) (8.3.1)\n",
      "Collecting imagehash\n",
      "  Downloading ImageHash-4.2.1.tar.gz (812 kB)\n"
     ]
    },
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "ERROR: Exception:\n",
      "Traceback (most recent call last):\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 438, in _error_catcher\n",
      "    yield\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 519, in read\n",
      "    data = self._fp.read(amt) if not fp_closed else b\"\"\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\cachecontrol\\filewrapper.py\", line 62, in read\n",
      "    data = self.__fp.read(amt)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\http\\client.py\", line 459, in read\n",
      "    n = self.readinto(b)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\http\\client.py\", line 503, in readinto\n",
      "    n = self.fp.readinto(b)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\socket.py\", line 704, in readinto\n",
      "    return self._sock.recv_into(b)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\ssl.py\", line 1241, in recv_into\n",
      "    return self.read(nbytes, buffer)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\ssl.py\", line 1099, in read\n",
      "    return self._sslobj.read(len, buffer)\n",
      "socket.timeout: The read operation timed out\n",
      "\n",
      "During handling of the above exception, another exception occurred:\n",
      "\n",
      "Traceback (most recent call last):\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\cli\\base_command.py\", line 173, in _main\n",
      "    status = self.run(options, args)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\cli\\req_command.py\", line 203, in wrapper\n",
      "    return func(self, options, args)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\commands\\install.py\", line 315, in run\n",
      "    requirement_set = resolver.resolve(\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\resolver.py\", line 94, in resolve\n",
      "    result = self._result = resolver.resolve(\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 472, in resolve\n",
      "    state = resolution.resolve(requirements, max_rounds=max_rounds)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 366, in resolve\n",
      "    failure_causes = self._attempt_to_pin_criterion(name)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 212, in _attempt_to_pin_criterion\n",
      "    criteria = self._get_updated_criteria(candidate)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 203, in _get_updated_criteria\n",
      "    self._add_to_criteria(criteria, requirement, parent=candidate)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 172, in _add_to_criteria\n",
      "    if not criterion.candidates:\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\resolvelib\\structs.py\", line 151, in __bool__\n",
      "    return bool(self._sequence)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\found_candidates.py\", line 140, in __bool__\n",
      "    return any(self)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\found_candidates.py\", line 128, in <genexpr>\n",
      "    return (c for c in iterator if id(c) not in self._incompatible_ids)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\found_candidates.py\", line 32, in _iter_built\n",
      "    candidate = func()\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\factory.py\", line 204, in _make_candidate_from_link\n",
      "    self._link_candidate_cache[link] = LinkCandidate(\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 295, in __init__\n",
      "    super().__init__(\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 156, in __init__\n",
      "    self.dist = self._prepare()\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 227, in _prepare\n",
      "    dist = self._prepare_distribution()\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 305, in _prepare_distribution\n",
      "    return self._factory.preparer.prepare_linked_requirement(\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 508, in prepare_linked_requirement\n",
      "    return self._prepare_linked_requirement(req, parallel_builds)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 550, in _prepare_linked_requirement\n",
      "    local_file = unpack_url(\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 239, in unpack_url\n",
      "    file = get_http_url(\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 102, in get_http_url\n",
      "    from_path, content_type = download(link, temp_dir.path)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\network\\download.py\", line 145, in __call__\n",
      "    for chunk in chunks:\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\cli\\progress_bars.py\", line 144, in iter\n",
      "    for x in it:\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_internal\\network\\utils.py\", line 63, in response_chunks\n",
      "    for chunk in response.raw.stream(\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 576, in stream\n",
      "    data = self.read(amt=amt, decode_content=decode_content)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 541, in read\n",
      "    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\contextlib.py\", line 135, in __exit__\n",
      "    self.gen.throw(type, value, traceback)\n",
      "  File \"C:\\Users\\songzhao\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 443, in _error_catcher\n",
      "    raise ReadTimeoutError(self._pool, None, \"Read timed out.\")\n",
      "pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "source": [
    "import pandas_profiling"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "source": [
    "pandas_profiling.ProfileReport(df)"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 19 - sweetviz\n",
    "\n",
    "如果没有提前安装 `sweetviz` 的话，需要提前 `pip` 进行安装"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [
    "! pip install sweetviz"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [
    "import sweetviz as sv\n",
    "\n",
    "report = sv.analyze(df)\n",
    "report.show_html()"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "执行完上面的代码后，当前目录下会出现一个html文件，打开即可看到相关 EDA 报告"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "![](http://liuzaoqi.oss-cn-beijing.aliyuncs.com/2021/09/16/16317972442543.jpg?域名/sample.jpg?x-oss-process=style/stylename)"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3.7.3 64-bit"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "interpreter": {
   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}